package com.sgj.common.utils;

import com.sgj.common.exception.Checker;
import com.sgj.entity.User;

import java.util.Arrays;
import java.util.List;

/**
 * @Author: Guoji Shen
 * @Date: 2022/1/24 14:29
 */
public class Test {

    public static void main(String[] args) {

        System.out.println(BooleanUtil.judgeConditionByFunction(12345, value -> String.valueOf(value).length() >= 5));

        System.out.println(BooleanUtil.testAndMethod("zhangsan", stringOne -> stringOne.equals("zhangsan"), stringTwo -> stringTwo.length() > 5));

        System.out.println(BooleanUtil.testOrMethod("zhangsan", stringOne -> stringOne.equals("zhangsa"), stringTwo -> stringTwo.length() > 5));

        System.out.println(BooleanUtil.testNageteMethod("zhangsan", stringOne -> stringOne.equals("zhangsa")));

        System.out.println(BooleanUtil.testMethodIsEquals(null,"zhangsa"));

        User user = new User();
        // Checker.ifThen(user, user1 -> user1.getUsername().equals(null), user1 -> user1.setUsername("小沈"));
        // System.out.println(user);
        String a = null;
        Checker.ifThen(a, c -> c == null, b -> user.setUsername("aaa"));
        System.out.println(user);

        List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5);
        integers.forEach(System.out::print);
    }
}